//
//  ZDDEmoticonPageView.swift
//  小蜗牛_新浪微博
//
//  Created by 周冬冬 on 16/7/4.
//  Copyright © 2016年 我的mac. All rights reserved.
//

import UIKit
private let ZDDEmoticonPageViewCellId = "ZDDEmoticonPageViewCellId"
class ZDDEmoticonPageView: UICollectionView {

    override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
        super.init(frame: frame, collectionViewLayout: UICollectionViewFlowLayout())
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func setupUI(){
    
        backgroundColor = RandomColor()
        //注册
        registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: ZDDEmoticonPageViewCellId)
        let layout = collectionViewLayout as! UICollectionViewFlowLayout
        
        layout.itemSize = CGSize(width: kScreenW, height: 216 - 37)
        layout.minimumInteritemSpacing = 0
        layout.minimumLineSpacing = 0
        layout.scrollDirection = .Horizontal
    
        dataSource = self
    }
}
extension ZDDEmoticonPageView: UICollectionViewDataSource {

    func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
        return 3
    }
    func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return 3
    }
    
    func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCellWithReuseIdentifier(ZDDEmoticonPageViewCellId, forIndexPath: indexPath)
        cell.backgroundColor = RandomColor()
        return cell
    }




}













